﻿using System;
using System.Linq;
using Microsoft.WindowsAzure.StorageClient;

namespace Caramel.WindowsAzure
{
	public class TableStorageRepository<T> : IRepository<T> where T : TableServiceEntity
	{
		public TableStorageRepository(TableServiceContext context)
		{
			this.Context = context;
		}

		public TableServiceContext Context { get; set; }

		public T Get(object id)
		{
			//this.Context.
			throw new NotImplementedException();
		}

		public void Save(T entity)
		{
			// Hmmmm

			throw new NotImplementedException();
		}

		public void Delete(T entity)
		{
			this.Context.DeleteObject(entity);
		}

		public void DeleteAll()
		{
			throw new NotImplementedException();
		}

		public IQueryable<T> All
		{
			get
			{
				return this.Context.CreateQuery<T>(typeof(T).Name);
			}
		}
	}
}
